package com.demo.download;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Http {

	ExecutorService pool = null;

	public Http(int poosSize) {
		pool = Executors.newFixedThreadPool(poosSize);
	}

	public Http() {
		pool = Executors.newFixedThreadPool(10);
	}

	public void downloads(List<String> urls, String savePath) {
		for (int i = 0; i < urls.size(); i++) {

			Download dl = new Download(urls.get(i), System.nanoTime() + ".jpg", savePath);
			System.out.println(" ==== > 开始从" + urls.get(i) + "下载图片--");
			pool.execute(dl);
		}

	}

}
